From 2ea33061b38d5997323293da150b1bda8c6beba2 Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Mon, 31 Aug 2009 09:54:25 +0100 Subject: [PATCH] x86_emulate: honor failure of in_longmode() Failure of in_longmode() shouldn't be treated the same as the function returning 'true'. Signed-off-by: Jan Beulich --- xen/arch/x86/x86_emulate/x86_emulate.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c index 5f8361e2b2..f2dfdf0c19 100644 --- a/xen/arch/x86/x86_emulate/x86_emulate.c +++ b/xen/arch/x86/x86_emulate/x86_emulate.c @@ -3605,7 +3605,10 @@ x86_emulate( ss.attr.bytes = 0xc93; /* G+DB+P+S+Data */ #ifdef __x86_64__ - if ( in_longmode(ctxt, ops) ) + rc = in_longmode(ctxt, ops); + if ( rc < 0 ) + goto cannot_emulate; + if ( rc ) { cs.attr.fields.db = 0; cs.attr.fields.l = 1; @@ -3777,7 +3780,10 @@ x86_emulate( ss.limit = ~0u; /* 4GB limit */ ss.attr.bytes = 0xc93; /* G+DB+P+S+Data */ - if ( in_longmode(ctxt, ops) ) + rc = in_longmode(ctxt, ops); + if ( rc < 0 ) + goto cannot_emulate; + if ( rc ) { cs.attr.fields.db = 0; cs.attr.fields.l = 1; -- 2.30.2